<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
<title></title>
</head>
<body>
<form name="form1">
    用户名：<input type="text" onFocus="txtfocus(event)" onBlur="txtblur(event)"><br>
    密码：<input type="text" onFocus="txtfocus(event)" onBlur="txtblur(event)">
</form>
<script type="text/javascript">
    function txtfocus(event){
        var obj=event.target;
        obj.style.border="3px solid #FF0000";
    }
    function txtblur(event){
        var obj=event.target;
        obj.style.border="";
    }
</script>
</body>
</html>
